<template>
    <div class="form-container">
        <h2>管理员登录</h2>
        <form>
            <input type="phone" v-model="user.phone" placeholder="手机号" required />
            <input type="password" v-model="user.password" placeholder="密码" required />
            <div class="tip">
                <router-link to="/login" class="login-link">返回</router-link>
            </div>
            <button @click.prevent="adminlogin">登录</button>
        </form>
    </div>
</template>

<script setup>
import useUser from "@/hooks/useUser.js";
const { user, login, adminlogin } = useUser();
</script>

<style scoped>
.form-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 300px;
    margin: 0 auto;
    margin-top: 200px;
}

h2 {
    margin-bottom: 20px;
    text-align: center;
}

input {
    width: 100%;
    padding-top: 12px;
    padding-bottom: 12px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

button {
    width: 100%;
    padding: 10px;
    margin: 1px;
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    background-color: #5aa39a;
}

button:hover {
    background-color: #218838;
}

.tip {
    text-align: right;
    margin: 10px 0;
}

.login-link {
    color: #5aa39a;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}
</style>